package com.leyou.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.leyou.constant.SmsProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * User: ycs
 * Date: 2020/8/28
 * Time: 16:30
 *
 * @author: ycs
 * Description: No Description
 */
@Configuration
@EnableConfigurationProperties(SmsProperties.class)
public class SmsConfiguration {
    @Bean
    public IAcsClient getClient(SmsProperties smsProperties) {
        DefaultProfile profile = DefaultProfile.getProfile(smsProperties.getRegionID(),
                smsProperties.getAccessKeyID(), smsProperties.getAccessKeySecret());
        return new DefaultAcsClient(profile);
    }
}
